# -*- coding: utf-8 -*-
import sqlite3

class MySqlite3:
    def __init__(self, db_name):
        self.db_name = db_name
        self._conn = None
    def __del__(self):
        if self._conn is not None:
            self._conn.close()
    def connect(self, db_name = ""):
        if len(db_name) == 0:
            self._conn = sqlite3.connect(self.db_name)
        else:
            self._conn = sqlite3.connect(db_name)

        return True
    def query(self, sql):
        if self._conn is None:
            return None
        if len(sql) is 0:
            return None
        cursor = self._conn.cursor()
        return cursor.execute(sql)
    def close(self):
        if self._conn is not None:
            self._conn.close()

